home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2007 December / PCWKCD1207B.iso / Blogowanie poza sfera / Flock 0.9.1.3 stable / flock-0.9.1.3.en-US.win32.exe / flock / chrome / browser.jar / content / browser / bookmarks / bookmarksTree.xml < prev    next >
Extensible Markup Language  |  2007-08-31  |  74KB  |  1,684 lines

  1. <?xml version="1.0"?>  
  2.  
  3.  
  4. <!DOCTYPE window [
  5.   <!ENTITY % bookmarksDTD SYSTEM "chrome://browser/locale/bookmarks/bookmarks.dtd" >
  6.   %bookmarksDTD;
  7. ]>
  8.  
  9. <bindings id="bookmarksBindings" 
  10.           xmlns="http://www.mozilla.org/xbl" 
  11.           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
  12.           xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  13.           xmlns:xbl="http://www.mozilla.org/xbl">
  14.  
  15.   <binding id="bookmarks-tree">
  16.     <implementation>
  17.       <constructor><![CDATA[
  18.         // This function only reads in the bookmarks from disk if they have not already been read.
  19.         initServices();
  20.         initBMService();
  21.  
  22.         BMSVC.readBookmarks();
  23.         
  24.         // We implement nsIController
  25.         this.tree.controllers.appendController(this.controller);
  26.         var olb = document.getAnonymousElementByAttribute(this, "anonid", "bookmarks-tree");
  27.         olb = olb.builder.QueryInterface(Components.interfaces.nsIXULTreeBuilder);
  28.         olb.addObserver(this.builderObserver);
  29.  
  30.         // Load column settings from persisted attribute
  31.         var colinfostr = this.getAttribute("colinfo");
  32.         var colinfo = colinfostr.split(" ");
  33.         for (var i = 0; i < colinfo.length; ++i) {
  34.           if (colinfo[i] == "") continue;
  35.  
  36.           var querymarker = colinfo[i].indexOf("?");
  37.           var anonid = colinfo[i].substring(4, querymarker);
  38.           var col = document.getAnonymousElementByAttribute(this, "id", anonid);
  39.  
  40.           if (!anonid || !col) break;
  41.  
  42.           var attrstring = colinfo[i].substr(querymarker + 1);
  43.  
  44.           var attrpairs = attrstring.split("&");
  45.           for (var j = 0; j < attrpairs.length; ++j) {
  46.             var pair = attrpairs[j].split("=");
  47.             col.setAttribute(pair[0], pair[1]);
  48.           }
  49.         }
  50.         
  51.         // Load sort data from preferences
  52.         this.refreshSort();
  53.         
  54.         // Observe for changes in sort from other concurrent UI
  55.         const kPrefSvcContractID = "@mozilla.org/preferences-service;1";
  56.         const kPrefSvcIID = Components.interfaces.nsIPrefService;
  57.         var prefSvc = Components.classes[kPrefSvcContractID].getService(kPrefSvcIID);
  58.         var prefs = prefSvc.getBranch(null);
  59.         const kPrefBranchInternalIID = Components.interfaces.nsIPrefBranch2;
  60.         var bookmarksPrefsInternal = prefs.QueryInterface(kPrefBranchInternalIID);
  61.         bookmarksPrefsInternal.addObserver(this.sortChangedObserver.domain, 
  62.                                            this.sortChangedObserver, false);
  63.       ]]></constructor>
  64.       <destructor><![CDATA[
  65.         
  66.         this.treeBuilder.removeObserver(this.builderObserver);
  67.         this.tree.controllers.removeController(this.controller);
  68.  
  69.         // Save column settings and sort info to persisted attribute
  70.         var persistString = "";
  71.         
  72.         var sortResource = gNC_NS + "Name";
  73.         var sortDirection = "none";
  74.  
  75.         var treecols = document.getAnonymousElementByAttribute(this, "anonid", "treecols");
  76.         var child = treecols.firstChild;
  77.         while (child) {
  78.           if (child.localName != "splitter") {
  79.             var formatString = " col:%1%?width=%2%&hidden=%3%&ordinal=%6%";
  80.             formatString = formatString.replace(/%1%/, child.getAttribute("id"));
  81.             formatString = formatString.replace(/%2%/, child.getAttribute("width"));
  82.             formatString = formatString.replace(/%3%/, child.getAttribute("hidden"));
  83.  
  84.             // While we're walking the columns, if we discover the column that represents the
  85.             // field sorted by, save the resource associated with that column so that we 
  86.             // can save that in prefs (see below)
  87.             if (child.getAttribute("sortActive") == "true") {
  88.               sortResource = child.getAttribute("sort");
  89.               sortDirection = child.getAttribute("sortDirection");
  90.             }
  91.             formatString = formatString.replace(/%6%/, child.getAttribute("ordinal"));
  92.             persistString += formatString;
  93.           }
  94.           child = child.nextSibling;
  95.         }
  96.         this.setAttribute("colinfo", persistString);
  97.         
  98.         document.persist(this.id, "colinfo");
  99.         
  100.         // Unhook the sort change observer for this tree
  101.         const kPrefSvcContractID = "@mozilla.org/preferences-service;1";
  102.         const kPrefSvcIID = Components.interfaces.nsIPrefService;
  103.         var prefSvc = Components.classes[kPrefSvcContractID].getService(kPrefSvcIID);
  104.         var prefs = prefSvc.getBranch(null);
  105.         const kPrefBranchInternalIID = Components.interfaces.nsIPrefBranch2;
  106.         var bookmarksPrefsInternal = prefs.QueryInterface(kPrefBranchInternalIID);
  107.         bookmarksPrefsInternal.removeObserver(this.sortChangedObserver.domain, 
  108.                                               this.sortChangedObserver);
  109.  
  110.       ]]></destructor>
  111.  
  112.       <property name="db">
  113.         <getter><![CDATA[
  114.           return this.tree.database;
  115.         ]]></getter>
  116.       </property>      
  117.       
  118.       <field name="sortChangedObserver">
  119.       <![CDATA[
  120.       ({
  121.         outer: this,
  122.         domain: "browser.bookmarks.sort",
  123.         observe: function BMOL_sortChangedObserver(aSubject, aTopic, aPrefName) 
  124.         {
  125.           if (aTopic != "nsPref:changed") return;
  126.           if (aPrefName.substr(0, this.domain.length) != this.domain) return;
  127.                     
  128.           this.outer.refreshSort();
  129.         }      
  130.       })
  131.       ]]>
  132.       </field>
  133.       
  134.       <field name="sorted">false</field>
  135.       <method name="refreshSort">
  136.         <body>
  137.         <![CDATA[
  138.           const kPrefSvcContractID = "@mozilla.org/preferences-service;1";
  139.           const kPrefSvcIID = Components.interfaces.nsIPrefService;
  140.           var prefSvc = Components.classes[kPrefSvcContractID].getService(kPrefSvcIID);
  141.           var bookmarksSortPrefs = prefSvc.getBranch("browser.bookmarks.sort.");
  142.           
  143.           // This ensures that we don't sort twice in the tree that is clicked on 
  144.           // as a result of 1) the click and 2) the pref listener. 
  145.           if (!this.sorted) {
  146.             try {
  147.               var sortResource = bookmarksSortPrefs.getCharPref("resource");
  148.               var sortDirection = bookmarksSortPrefs.getCharPref("direction");
  149.           
  150.               // Walk the columns, when we find a column with a sort resource that matches the supplied
  151.               // data, stop and make sure it's sort active. 
  152.               var treecols = document.getAnonymousElementByAttribute(this, "anonid", "treecols");
  153.               var child = treecols.firstChild;
  154.               while (child) {
  155.                 if (child.localName != "splitter") {
  156.                   if (child.getAttribute("sort") == sortResource) {
  157.                     child.setAttribute("sortActive", "true");
  158.                     child.setAttribute("sortDirection", sortDirection);
  159.                     this.treeBuilder.sort(child, false);
  160.                     break;
  161.                   }
  162.                 }          
  163.                 child = child.nextSibling;
  164.               }
  165.             }
  166.             catch (e) {
  167.               dump("error in refresh sort:"+e)
  168.             }
  169.           }
  170.  
  171.           this.sorted = false;
  172.         ]]>
  173.         </body>
  174.       </method>
  175.       
  176.       <property name="columns">
  177.         <getter>
  178.         <![CDATA[
  179.           var cols = [];
  180.         
  181.           var treecols = document.getAnonymousElementByAttribute(this, "anonid", "treecols");
  182.           var child = treecols.firstChild;
  183.           while (child) {
  184.             if (child.localName != "splitter") {
  185.               var obj = {
  186.                 label: child.getAttribute("label"),
  187.                 accesskey: child.getAttribute("accesskey"),
  188.                 resource: child.getAttribute("sort"),
  189.                 sortActive: child.getAttribute("sortActive") == "true",
  190.                 hidden: child.getAttribute("hidden")
  191.               }
  192.               cols.push(obj);
  193.             }
  194.             child = child.nextSibling;
  195.           }
  196.  
  197.           return cols;
  198.         ]]>
  199.         </getter>
  200.       </property>
  201.       
  202.       <method name="toggleColumnVisibility">
  203.         <parameter name="aColumnResource"/>
  204.         <body>
  205.         <![CDATA[
  206.           var elt = document.getAnonymousElementByAttribute(this, "sort", aColumnResource);
  207.           if (elt)
  208.             elt.setAttribute("hidden", elt.getAttribute("hidden") != "true");
  209.         ]]>
  210.         </body>
  211.       </method>      
  212.  
  213.       <property name="tree">
  214.         <getter><![CDATA[
  215.           return document.getAnonymousElementByAttribute(this, "anonid", "bookmarks-tree");
  216.         ]]></getter>
  217.       </property>
  218.  
  219.       <property name="treeBoxObject">
  220.         <getter><![CDATA[
  221.           return this.tree.boxObject.QueryInterface(Components.interfaces.nsITreeBoxObject);
  222.         ]]></getter>
  223.       </property>
  224.  
  225.       <property name="treeBuilder">
  226.         <getter><![CDATA[
  227.           return this.tree.builder.QueryInterface(Components.interfaces.nsIXULTreeBuilder);
  228.         ]]></getter>
  229.       </property>
  230.  
  231.       <property name="type">
  232.         <getter><![CDATA[
  233.           if (!this._type) {
  234.             var type = this.getAttribute("type");
  235.             if (!type)
  236.               type = "multi-column";
  237.             this._type = type;
  238.           }
  239.           return this._type;
  240.         ]]></getter>
  241.       </property>
  242.  
  243.       <property name="currentIndex">
  244.         <getter><![CDATA[
  245.           return this.treeBoxObject.view.selection.currentIndex;
  246.         ]]></getter>
  247.       </property>
  248.     
  249.       <property name="currentResource">
  250.         <getter><![CDATA[
  251.           return this.treeBuilder.getResourceAtIndex(this.currentIndex);
  252.         ]]></getter>
  253.       </property>
  254.  
  255.       <method name="getRowResource">
  256.         <parameter name="aRow"/>
  257.         <body><![CDATA[
  258.           if (aRow != -1)
  259.             return this.treeBuilder.getResourceAtIndex(aRow);
  260.           else
  261.             return this.getRootResource();
  262.         ]]></body>
  263.       </method>
  264.  
  265.       <method name="getParentResource">
  266.         <parameter name="aRow"/>
  267.         <body><![CDATA[
  268.           if (aRow != -1) {
  269.             var parentIndex = this.treeBoxObject.view.getParentIndex(aRow);
  270.             return this.getRowResource(parentIndex);
  271.           }
  272.           return this.getRootResource(); // assume its parent is the root
  273.         ]]></body>
  274.       </method>
  275.  
  276.       <method name="getRootResource">
  277.         <body><![CDATA[
  278.           var tree = document.getAnonymousElementByAttribute(this, "anonid", "bookmarks-tree");
  279.           return RDF.GetResource(tree.ref);
  280.         ]]></body>
  281.       </method>
  282.  
  283.       <method name="selectResource">
  284.         <parameter name="aResource"/>
  285.         <body><![CDATA[
  286.           var index = this.treeBuilder.getIndexOfResource(aResource);
  287.           if (index != -1) {
  288.             if (!this.treeBoxObject.view.selection.isSelected(index))
  289.               this.treeBoxObject.view.selection.toggleSelect(index);
  290.             return;
  291.           }
  292.          
  293.           var chain = BMSVC.getParentChain(aResource);
  294.           //dump("Chain:"+chain.length+"\n");
  295.           for (var i=0; i<chain.length; i++) {
  296.             var rParent = chain.queryElementAt(i, kRDFRSCIID);
  297.             index = this.treeBuilder.getIndexOfResource(rParent);
  298.             //dump(i+":"+BookmarksUtils.getProperty(rParent, gNC_NS+"Name")+", index:"+index+"\n");
  299.             if (index == -1)
  300.               continue;
  301.  
  302.             if (!this.treeBoxObject.view.isContainerOpen(index))
  303.               this.treeBoxObject.view.toggleOpenState(index);
  304.           }
  305.           if (index == -1)
  306.             return;
  307.  
  308.           index = this.treeBuilder.getIndexOfResource(aResource);
  309.           if (index != -1)
  310.             this.treeBoxObject.view.selection.toggleSelect(index);
  311.         ]]></body>
  312.       </method>
  313.  
  314.       <method name="focus">
  315.         <body>
  316.           this.tree.focus();
  317.         </body>
  318.       </method>
  319.  
  320.       <field name="_selection">null</field>
  321.       <field name="_target">   null</field>
  322.  
  323.       <method name="getTreeSelection">
  324.         <body><![CDATA[
  325.           var selection        = {};
  326.           selection.item       = [];
  327.           selection.parent     = [];
  328.           selection.isExpanded = [];
  329.           var rangeCount = this.treeBoxObject.view.selection.getRangeCount();
  330.           // workaround for bug 171547: if rowCount==0, rangeCount==1
  331.           if (this.treeBuilder.rowCount > 0)
  332.           for (var k = 0; k < rangeCount; ++k) {
  333.             var rangeMin = {};
  334.             var rangeMax = {};
  335.             this.treeBoxObject.view.selection.getRangeAt(k, rangeMin, rangeMax);
  336.             for (var i = rangeMin.value; i <= rangeMax.value; ++i) {
  337.               var selectedItem   = this.getRowResource(i);
  338.               var selectedParent = this.getParentResource(i);
  339.               var isExpanded     = this.treeBoxObject.view.isContainerOpen(i);
  340.               selection.item  .push(selectedItem);
  341.               selection.parent.push(selectedParent);
  342.               selection.isExpanded.push(isExpanded);
  343.             }
  344.           }
  345.           selection.length = selection.item.length;      
  346.           BookmarksUtils.checkSelection(selection);
  347.           
  348.           return selection;
  349.         ]]></body>
  350.       </method>
  351.  
  352.       <method name="getTreeTarget">
  353.         <parameter name="aItem"/>
  354.         <parameter name="aParent"/>
  355.         <parameter name="aOrientation"/>
  356.         <body><![CDATA[
  357.  
  358.           if (!aParent || aParent.Value == "NS1:FoldersRoot")
  359.             return BookmarksUtils.getTargetFromFolder(RDF.GetResource("NS1:BookmarksRoot"))
  360.  
  361.           if (aOrientation == BookmarksUtils.DROP_ON)
  362.             return BookmarksUtils.getTargetFromFolder(aItem);
  363.  
  364.           RDFC.Init(this.db, aParent);
  365.           var index = RDFC.IndexOf(aItem);
  366.           if (aOrientation == BookmarksUtils.DROP_AFTER)
  367.             ++index;
  368.           return { parent: aParent, index: index };
  369.         ]]></body>
  370.       </method>
  371.  
  372.       # This function saves the current selection state before the tree is rebuilt
  373.       # following a command execution. This allows us to remember which item(s)
  374.       # was/were selected so that the user does not need to constantly refocus the 
  375.       # tree to perform a sequence of commands. 
  376.       <field name="_savedSelection">[]</field>
  377.       <method name="saveSelection">
  378.         <body><![CDATA[
  379.           var selection = this.treeBoxObject.view.selection;
  380.           var rangeCount = selection.getRangeCount();
  381.           var ranges = [];
  382.           var min = {}; var max = {};
  383.           for (var i = 0; i < rangeCount; ++i) {
  384.             selection.getRangeAt(i, min, max);
  385.             ranges.push({min: min.value, max: max.value});
  386.           }
  387.           this._savedSelection = ranges;
  388.         ]]></body>
  389.       </method>
  390.       
  391.       # This function restores the selection appropriately after a command executes. 
  392.       # This is necessary because most commands trigger a rebuild of the tree which
  393.       # destroys the selection. The restoration of selection is handled in three 
  394.       # different ways depending on the type of command that has been executed:
  395.       #  1) Commands that remove rows:
  396.       #       The row immediately after the first range in the selection is selected, 
  397.       #       if there is no row immediately after the first range the item before it
  398.       #       is selected
  399.       #  2) Commands that insert rows:
  400.       #       The newly inserted rows are selected
  401.       #  3) Commands that do not change the row count 
  402.       #       The row(s) that was/were operated on remain selected.
  403.       # 
  404.       # The calls to save/restore are placed in the doCommand method and thus all
  405.       # commands must pass through this gate. The result is that this method becomes
  406.       # the POLICY CENTER FOR POST-VIEW/EDIT SELECTION CHANGES.
  407.       <method name="restoreSelection">
  408.         <parameter name="aCommand"/>
  409.         <body><![CDATA[ 
  410.           var oldRanges = this._savedSelection;
  411.           var newRanges = [];
  412.  
  413.           switch(aCommand) {
  414.           // [Category 1] - Commands that remove rows
  415.           case "cmd_cut":
  416.           case "cmd_delete":
  417.             // Since rows have been removed, the row immediately after the first range 
  418.             // in the original selection now has the index of the first item in the first
  419.             // range. 
  420.             var nextRow = oldRanges[0].min;
  421.             var maxCount = this.treeBoxObject.view.rowCount;
  422.             if (nextRow >= maxCount)
  423.               nextRow = maxCount-1;
  424.             if (nextRow >= 0)
  425.               newRanges.push({min: nextRow, max: nextRow});
  426.             break;
  427.           // [Category 2] - Commands that insert rows
  428.           case "cmd_paste":
  429.           case "cmd_bm_import":
  430.           case "cmd_bm_movebookmark":
  431.           case "cmd_bm_newbookmark":
  432.           case "cmd_bm_newfolder":
  433.           case "cmd_bm_newseparator":
  434.           case "cmd_undo": //XXXpch: doesn't work for insert
  435.           case "cmd_redo": //XXXpch: doesn't work for remove
  436.             // All items inserted will be selected. The implementation of this model
  437.             // is left to |preUpdateTreeSelection|, called when an insert transaction is
  438.             // executed, and |updateTreeSelection| called here. 
  439.             this.updateTreeSelection();
  440.             break;
  441.           // [Category 3] - Commands that do not alter the row count
  442.           case "cmd_copy":
  443.           case "cmd_bm_properties":
  444.           case "cmd_bm_rename":
  445.           case "cmd_bm_setpersonaltoolbarfolder":
  446.           case "cmd_bm_export":
  447.           default:
  448.             // The selection is unchanged.
  449.             return;
  450.           }
  451.           
  452.           var newSelection = this.treeBoxObject.view.selection;
  453.           for (i = 0; i < newRanges.length; ++i)
  454.             newSelection.rangedSelect(newRanges[i].min, newRanges[i].max, true);
  455.         ]]></body>
  456.       </method>
  457.  
  458.       <field name="_itemToBeToggled">  []</field>
  459.       // keep track of the items that we will select
  460.       // because we can not select rows during a batch.
  461.       <method name="preUpdateTreeSelection">
  462.         <parameter name="aTxn"/>
  463.         <parameter name="aDo"/>
  464.         <body><![CDATA[
  465.           if (aTxn) {
  466.             aTxn = aTxn.wrappedJSObject;
  467.             var type = aTxn.type;
  468.             // Skip transactions that aggregates nested "insert" or "remove" transactions.
  469.             if ((type == "insert") && aDo || (type == "remove") && !aDo)
  470.               this._itemToBeToggled = [aTxn.item];
  471.           } else {
  472.             var txnList;
  473.             var bkmkTxnSvc = Components.classes["@mozilla.org/bookmarks/transactionmanager;1"]
  474.                                        .getService(Components.interfaces.nsIBookmarkTransactionManager);
  475.             var txmgr = bkmkTxnSvc.transactionManager;
  476.             if (this.bookmarkTreeTransactionListener.mLastTxnWasDo) {
  477.               txnList = txmgr.getUndoList();
  478.             } else {
  479.               txnList = txmgr.getRedoList();
  480.             }
  481.             var items =[];
  482.             var childList = txnList.getChildListForItem(txnList.numItems-1);
  483.             for (var i=0; i<childList.numItems; i++) {
  484.               items.push(childList.getItem(i).wrappedJSObject.item);
  485.             }
  486.             this._itemToBeToggled = items;
  487.           }
  488.         },
  489.         ]]></body>
  490.       </method>
  491.  
  492.       <method name="updateTreeSelection">
  493.         <body><![CDATA[
  494.           this.treeBoxObject.view.selection.clearSelection();
  495.           for (var i=0; i<this._itemToBeToggled.length; ++i) {
  496.             index = this.treeBuilder.getIndexOfResource(this._itemToBeToggled[i]);
  497.             if (index != -1 && !this.treeBoxObject.view.selection.isSelected(index))
  498.               this.treeBoxObject.view.selection.toggleSelect(index);
  499.           }
  500.         ]]></body>
  501.       </method>
  502.  
  503.       <method name="createTreeContextMenu">
  504.         <parameter name="aEvent"/>
  505.         <body><![CDATA[
  506.           this._selection = this.getTreeSelection();
  507.           var target    = this._target;
  508.           BookmarksCommand.createContextMenu(aEvent, this._selection);
  509.           this.onCommandUpdate();
  510.         ]]></body>
  511.       </method>
  512.  
  513.       <method name="openItemClick">
  514.         <parameter name="aEvent"/>
  515.         <parameter name="aClickCount"/>
  516.         <body><![CDATA[
  517.           dump("BookmarksTree: openItemClick on " + aEvent + "\n");
  518.           var selection = this.getSelection(aEvent, aClickCount);
  519.           if(selection)
  520.           {
  521.             var browserTarget = whereToOpenLink(aEvent);
  522.             BookmarksCommand.openBookmark(selection, browserTarget, this.db);
  523.           }
  524.         ]]></body>
  525.       </method>
  526.       <method name="openItemKey">
  527.         <body><![CDATA[
  528.           if (this._selection.length != 1) {
  529.             return;
  530.           }
  531.           if (!this._selection.isContainer[0])
  532.             BookmarksCommand.openBookmark(this._selection, "current", this.db)
  533.         ]]></body>
  534.       </method>
  535.       <method name="getSelection">
  536.         <parameter name="aEvent"/>
  537.         <parameter name="aClickCount"/>
  538.         <body><![CDATA[
  539.           if (aEvent.button == 2 || aEvent.originalTarget.localName != "treechildren")
  540.             return;
  541.           if (aClickCount != this.clickCount && aEvent.button != 1)
  542.             return;
  543.  
  544.           var row = {};
  545.           var col = {};
  546.           var obj = {};
  547.           this.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, obj);
  548.           row = row.value;
  549.  
  550.           if (row == -1 || obj.value == "twisty")
  551.             return;
  552.           var modifKey = aEvent.shiftKey || aEvent.ctrlKey || aEvent.altKey || 
  553.                          aEvent.metaKey  || aEvent.button == 1;
  554.           if (this.clickCount == 2 && !modifKey &&
  555.               this.treeBoxObject.view.isContainer(row))
  556.             return;
  557.  
  558.           if (this.clickCount == 2 && modifKey) {
  559.             this.treeBoxObject.view.selection.select(row);
  560.             this._selection = this.getTreeSelection();
  561.           }
  562.           var selection = this._selection;
  563.  
  564.           if (selection.isContainer[0]) {
  565.             if (this.clickCount == 1 && !modifKey) {
  566.               this.treeBoxObject.view.toggleOpenState(row);
  567.               //XXXpch: broken since we have single IDs
  568.               //if (selection.protocol[0] != "file")
  569.                 return;
  570.             }
  571.           }
  572.           return selection;
  573.           ]]></body>
  574.       </method>
  575.       <method name="addFoldersToDS">
  576.         <parameter name="aDS"/>
  577.         <body><![CDATA[
  578.           var rdf = Components.classes["@mozilla.org/rdf/datasource;1?name=in-memory-datasource"].createInstance(Components.interfaces.nsIRDFDataSource);
  579.  
  580.           this.RDFS = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
  581.           this.RDFCU = Components.classes['@mozilla.org/rdf/container-utils;1'].getService (Components.interfaces.nsIRDFContainerUtils);
  582.           var searchresultRes = this.RDFS.GetResource('http://flock.com/rdf#searchresult');
  583.           var trueRes = this.RDFS.GetLiteral('true');
  584.           var resultList = aDS.GetSources(searchresultRes, trueRes, true);
  585.  
  586.           function addToDS(aResource) {
  587.             // Add the resource and its parents
  588.  
  589.             rdf.Assert(aResource, searchresultRes, trueRes, true);
  590.             
  591.             var arcs = BMSVC.ArcLabelsIn(aResource);
  592.             while (arcs && arcs.hasMoreElements()) {
  593.               var testresource = arcs.getNext();
  594.               if (testresource && testresource.QueryInterface)
  595.                 testresource =  testresource.QueryInterface(Components.interfaces.nsIRDFResource);
  596.               if (testresource && testresource.QueryInterface && this.RDFCU.IsOrdinalProperty(testresource)) {
  597.                 var sources = BMSVC.GetSources(testresource, aResource, true);
  598.                 while (sources && sources.hasMoreElements()) {
  599.                   var source = sources.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
  600.                   // Now put this and parents in the result RDF
  601.                   addToDS(source);
  602.                 }
  603.               }
  604.             }
  605.           }
  606.  
  607.           while (resultList.hasMoreElements ()) {
  608.             // Get the url from the lucene DS
  609.             var resultRes = resultList.getNext().QueryInterface (Components.interfaces.nsIRDFResource);
  610.             var url = resultRes.Value;
  611.  
  612.             // Now get the resource and its parents in the favorites service DS
  613.             addToDS(resultRes);
  614.           }
  615.           return rdf;
  616.         ]]></body>
  617.       </method>
  618.       <method name="searchBookmarks">
  619.       <parameter name="aInput"/>
  620.         <body><![CDATA[
  621.           if(!this.originalRef)
  622.               this.originalRef = this.tree.getAttribute("ref");
  623.           this.unfilterTree();
  624.  
  625.           if (!aInput) {
  626.             this.tree.setAttribute("ref", this.originalRef);
  627.           }
  628.           else {
  629.              // this.tree.setAttribute("ref",
  630.              // "find:datasource=rdf:flock-favorites&match=http://home.netscape.com/NC-rdf#Name&method=contains&text=" + encodeURIComponent(aInput));
  631.             var searcher = Components.classes["@flock.com/lucene/flockLucene;1"]
  632.               .getService(Components.interfaces.flockILucene);
  633.             var inst = this;
  634.             var dumpfunc = {}
  635.             dumpfunc.onSearchComplete = function (aNumResults, aDS) { 
  636.               if (inst.luceneDS) {
  637.                 inst.tree.database.RemoveDataSource(inst.luceneDS);
  638.               }
  639.               inst.luceneDS = inst.addFoldersToDS(aDS);
  640.               inst.filterTree();
  641.             }
  642.             searcher.search(normalizeQuery(aInput), "bookmark", 100, dumpfunc);
  643.  
  644.             var view = this.tree.view;
  645.             for (var i = 0; i < view.rowCount; i++) {
  646.               if (view.isContainer(i) && !view.isContainerOpen(i)) {
  647.                 view.toggleOpenState(i);
  648.               }
  649.             }
  650.           }
  651.         ]]></body>
  652.       </method>
  653.       <method name="refreshTree">
  654.         <body><![CDATA[
  655.           this.tree.builder.rebuild();
  656.         ]]></body>
  657.       </method>
  658.       <method name="unfilterTree">
  659.         <body><![CDATA[
  660.            var searchTriple = document.getAnonymousElementByAttribute(this, 'anonid', 'filterTriple');
  661.            if (searchTriple) searchTriple.parentNode.removeChild(searchTriple);
  662.            var fSearchTriple = document.getAnonymousElementByAttribute(this, 'anonid', 'fFilterTriple');
  663.            if (fSearchTriple) fSearchTriple.parentNode.removeChild(fSearchTriple);
  664.            this.tree.builder.rebuild();
  665.           //this.tree.removeAttribute("statedatasource");
  666.         ]]></body>
  667.       </method>
  668.       <method name="filterTree">
  669.         <body><![CDATA[
  670.           // JMC - Assume that we're keeping the lucene-returned ds
  671.           // as a property on the tree
  672.           if (!this.luceneDS) {
  673.             dump ("Why don't we have the ds?\n");
  674.             return;
  675.           }
  676.           this.tree.database.AddDataSource(this.luceneDS);
  677.  
  678.            var searchConditions = document.getAnonymousElementByAttribute(this, 'anonid', 'filterConditions');
  679.            var triple = document.createElement('triple');
  680.            triple.setAttribute('subject', '?start');
  681.            triple.setAttribute('predicate', 'http://flock.com/rdf#searchresult');
  682.            triple.setAttribute('object', 'true');
  683.            triple.setAttribute('anonid', 'filterTriple');
  684.            searchConditions.appendChild(triple);
  685.  
  686.            var fSearchConditions = document.getAnonymousElementByAttribute(this, 'anonid', 'folderFilterConditions');
  687.            var triple2 = document.createElement('triple');
  688.            triple2.setAttribute('subject', '?start');
  689.            triple2.setAttribute('predicate', 'http://flock.com/rdf#searchresult');
  690.            triple2.setAttribute('object', 'true');
  691.            triple2.setAttribute('anonid', 'fFilterTriple');
  692.            fSearchConditions.appendChild(triple2);
  693.  
  694.            this.tree.builder.rebuild();
  695.  
  696.           // We're gonna expand all containers for the filtered view, but we
  697.           // don't want those open states to be remembered for the unfiltered
  698.           // view, so change the statedatasource attribute
  699.           //this.tree.setAttribute("statedatasource", "rdf:null");
  700.  
  701.           var view = this.tree.view;
  702.           for (var i = 0; i < view.rowCount; i++) {
  703.             if (view.isContainer(i) && !view.isContainerOpen(i)) {
  704.               view.toggleOpenState(i);
  705.             }
  706.           }
  707.         ]]></body>
  708.       </method>
  709.  
  710.       <!-- observer -->
  711.       <field name="DNDObserver" readonly="true"><![CDATA[
  712.       ({
  713.         mOuter: this,
  714.         onDragStart: function (aEvent, aXferData, aDragAction)
  715.         {
  716.           
  717.           if (this.mOuter.tree.getAttribute("sortActive") == "true")
  718.             throw Components.results.NS_OK; 
  719.           var selection = this.mOuter._selection;
  720.           if(this.checkForOnlineParent(selection))
  721.           {
  722.             //ignore drag event if a tag.
  723.             if(this.isSelectionOnlineTag(selection)) { return; }
  724.             this.mOuter.setAttribute('onDragOver', true);
  725.           }
  726.           aXferData.data = BookmarksUtils.getXferDataFromSelection(selection);
  727.           if (aEvent.ctrlKey)
  728.             aDragAction.action = kDSIID.DRAGDROP_ACTION_COPY;
  729.         },
  730.         onDragOver: function (aEvent, aFlavour, aDragSession)
  731.         {
  732.           // allow dropping of bookmarks below the tree
  733.           if (aDragSession.sourceNode == this.mOuter)
  734.             aDragSession.canDrop = true;
  735.  
  736.         },
  737.         // the actual dropping happens in the nsIXULTreeBuilderObserver below
  738.         onDrop: function (aEvent, aXferData, aDragSession) 
  739.         { 
  740.           if(this.mOuter.hasAttribute('onDragOver'))
  741.           {
  742.             this.mOuter.removeAttribute('onDragOver');
  743.           }
  744.         },
  745.         getSupportedFlavours: function ()
  746.         {
  747.           var flavourSet = new FlavourSet();
  748.           flavourSet.appendFlavour("moz/rdfitem");
  749.           flavourSet.appendFlavour("application/x-moz-file", "nsIFile");
  750.           flavourSet.appendFlavour("text/x-moz-url");
  751.           flavourSet.appendFlavour("text/unicode");
  752.           return flavourSet;
  753.         },
  754.         isSelectionOnlineTag: function(aSelection)
  755.         {
  756.          return (aSelection.isContainer.length > 0 && aSelection.isContainer[0])
  757.         },
  758.         
  759.          checkForOnlineParent: function(aSelection)
  760.           {
  761.             var parentOnline = false;
  762.               
  763.             if(aSelection.length)
  764.             {
  765.               for (var i = 0; i < aSelection.length; i++) {
  766.                 if(!BookmarksUtils.foundLocalBookmarkParent(aSelection.parent[i].Value))
  767.                 {
  768.                   parentOnline = true;
  769.                   break;
  770.                 }
  771.               }
  772.             }else
  773.             {
  774.               if(!BookmarksUtils.foundLocalBookmarkParent(aSelection.Value))
  775.                 parentOnline = true;
  776.             }
  777.             return parentOnline;
  778.           },
  779.       })
  780.       ]]></field>      
  781.         
  782.       <!-- nsIController -->
  783.       <field name="controller" readonly="true"><![CDATA[
  784.       ({
  785.         mOuter: this,
  786.         
  787.         supportsCommand: BookmarksController.supportsCommand,
  788.         
  789.         isCommandEnabled: function (aCommand)
  790.         {
  791.           // warning: this is not the called function in BookmarksController.onCommandUpdate
  792.           var selection = this.mOuter._selection;
  793.           var target    = this.mOuter._target;
  794.           return BookmarksController.isCommandEnabled(aCommand, selection, target)
  795.         },
  796.  
  797.         doCommand: function (aCommand)
  798.         {
  799.           var selection = this.mOuter._selection;
  800.           var target    = this.mOuter._target;
  801.           this.mOuter.treeBoxObject.view.selection.selectEventsSuppressed = true;
  802.           this.mOuter._itemToBeToggled = [];
  803.           
  804.           switch (aCommand) {
  805.           case "cmd_selectAll":
  806.             this.mOuter.treeBoxObject.view.selection.selectAll();
  807.             break;
  808.           case "cmd_bm_newbookmark":
  809.           case "cmd_bm_properties":
  810.             this.mOuter.saveSelection();
  811.             BookmarksController.doCommand(aCommand, selection, target);
  812.             break;
  813.           default:
  814.             this.mOuter.saveSelection();
  815.             BookmarksController.doCommand(aCommand, selection, target);
  816.             this.mOuter.restoreSelection(aCommand);
  817.           }
  818.           this.mOuter.treeBoxObject.view.selection.selectEventsSuppressed = false;
  819.         }
  820.       })
  821.       ]]></field>
  822.  
  823.       <method name="onCommandUpdate">
  824.         <body><![CDATA[
  825.           var selection = this._selection;
  826.           var target    = this._target;
  827.           BookmarksController.onCommandUpdate(selection, target);
  828.         ]]></body>
  829.       </method>
  830.  
  831.       <method name="onFocus">
  832.         <parameter name="aEvent"/>
  833.         <body><![CDATA[ 
  834.           this.onCommandUpdate();
  835.         ]]></body>
  836.       </method>
  837.  
  838.       <!-- nsIXULTreeBuilderObserver -->
  839.       <field name="builderObserver"><![CDATA[
  840.       ({
  841.         mOuter: this,
  842.         canDrop: function(index, orientation)
  843.         {
  844.           var dragSession = DS.getCurrentSession();
  845.           if (!dragSession)
  846.             return false;
  847.  
  848.           var selection = BookmarksUtils.getSelectionFromXferData(dragSession);
  849.           var isBookmark = dragSession.isDataFlavorSupported("moz/rdfitem");
  850.           if (isBookmark && selection.containsImmutable)
  851.             return false;
  852.           if (orientation == BookmarksUtils.DROP_ON)
  853.             return true;
  854.           
  855.           var rsrc = this.mOuter.getRowResource(index);
  856.           var rsrcParent = this.mOuter.getParentResource(index);
  857.  
  858.           var rtype = BookmarksUtils.resolveType(rsrc);
  859.           var rptype = BookmarksUtils.resolveType(rsrcParent);
  860.  
  861.           if (!BookmarksUtils.isValidTargetContainer (rsrcParent, selection))
  862.               return false;
  863.  
  864.           if (index != 0)
  865.             return true;
  866.           if (rsrc.Value != "NS1:FoldersRoot")
  867.             return true;
  868.           return orientation == BookmarksUtils.DROP_BEFORE ? false : this.mOuter.treeBoxObject.view.isContainerOpen(0)
  869.         },
  870.  
  871.         onDrop: function(row, orientation)
  872.         {
  873.           var dragSession = DS.getCurrentSession();
  874.           if (!dragSession)
  875.             return;
  876.           //var date = Date.now();
  877.           var selection = BookmarksUtils.getSelectionFromXferData(dragSession);
  878.           var rItem     = this.mOuter.getRowResource(row);
  879.           var rParent   = this.mOuter.getParentResource(row);
  880.           var target;
  881.           if (orientation == BookmarksUtils.DROP_AFTER            &&
  882.               this.mOuter.treeBoxObject.view.isContainer(row)     &&
  883.               this.mOuter.treeBoxObject.view.isContainerOpen(row) &&
  884.              !this.mOuter.treeBoxObject.view.isContainerEmpty(row))
  885.             target = { parent: rItem, index: 1 };
  886.           else {
  887.             target = this.mOuter.getTreeTarget(rItem, rParent, orientation);
  888.           }
  889.           this.mOuter.treeBoxObject.view.selection.selectEventsSuppressed = true;
  890.           this.mOuter._itemToBeToggled = [];
  891.  
  892.           // we can only test for kCopyAction if the source is a bookmark
  893.           var checkCopy = dragSession.isDataFlavorSupported("moz/rdfitem");
  894.           const kCopyAction = kDSIID.DRAGDROP_ACTION_COPY + kDSIID.DRAGDROP_ACTION_LINK;
  895.  
  896.           // doCopy defaults to true; check if we should make it false.
  897.           // we make it false only if all the selection items have valid parent
  898.           // bookmark DS containers (i.e. aren't generated via aggregation)
  899.           var doCopy = true;
  900.           if (checkCopy && !(dragSession.dragAction & kCopyAction))
  901.             doCopy = BookmarksUtils.shouldCopySelection("drag", selection);
  902.           
  903.           if(this.checkForOnlineParent(selection))
  904.           {
  905.             if(this.checkForOnlineParent(target.parent))
  906.             {
  907.               this.publishOnline(selection, target);
  908.             }
  909.             else
  910.             {  
  911.               for(var i=0; i<selection.item.length; i++)
  912.               {
  913.                 saveOnlineBookmarkLocally(selection.item[i], target.parent.Value);
  914.               }
  915.             }
  916.           }else if(this.checkForOnlineParent(target.parent))
  917.           {
  918.             this.publishOnline(selection, target);
  919.           }
  920.          else if (doCopy) {
  921.             BookmarksUtils.insertAndCheckSelection("drag", selection, target);
  922.             var metrics = Components.classes['@flock.com/metrics-service;1'].getService(Components.interfaces.flockIMetricsService)
  923.             metrics.reportCount('new favorite by drop on bookmark tree');
  924.           }
  925.           else
  926.             BookmarksUtils.moveAndCheckSelection  ("drag", selection, target);
  927.  
  928.           if (this.mOuter._itemToBeToggled.length > 0)
  929.             this.mOuter.updateTreeSelection();
  930.           // use of a timer to speedup
  931.           var This = this.mOuter;
  932.           setTimeout( function (){This.treeBoxObject.view.selection.selectEventsSuppressed = false}, 100)
  933.           //dump("DND time:"+(Date.now()-date)+"\n")
  934.         },
  935.         publishOnline: function(selection, target)
  936.         {
  937.            const kPrefSvcContractID = "@mozilla.org/preferences-service;1";
  938.            const kPrefSvcIID = Components.interfaces.nsIPrefService;
  939.             var prefSvc = Components.classes[kPrefSvcContractID].getService(kPrefSvcIID);
  940.             var bookmarksSortPrefs = prefSvc.getBranch("flock.");
  941.             var doPublish = true;
  942.             if(!bookmarksSortPrefs.getBoolPref("favorites.doPublish.DontShowAgain"))
  943.             {
  944.               var sBS = Components.classes["@mozilla.org/intl/stringbundle;1"]
  945.                         .getService(Components.interfaces.nsIStringBundleService);
  946.               var sb = sBS
  947.                        .createBundle("chrome://flock/locale/favorites/bookmarksOverlay.properties");
  948.  
  949.               var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
  950.                                   .getService(Components.interfaces.nsIPromptService);
  951.               var checkResult = {};
  952.  
  953.               var title = sb.GetStringFromName("flock.prompt.publishBookmark.title");
  954.               var label = sb.GetStringFromName("flock.prompt.publishBookmark.label");
  955.               var dsLabel = sb.GetStringFromName("flock.prompt.publishBookmark.dontShow");
  956.  
  957.               if (!promptService.confirmCheck(
  958.                    window,
  959.                    title,
  960.                    label,
  961.                    dsLabel,
  962.                    checkResult
  963.                   )
  964.                  )
  965.                 {
  966.                   doPublish = false;
  967.                 }
  968.               if (checkResult.value)
  969.               {
  970.                 bookmarksSortPrefs.setBoolPref("favorites.doPublish.DontShowAgain", checkResult.value);
  971.               }
  972.             } 
  973.               if(doPublish)
  974.               {
  975.                 var onlineURN = target.parent.Value;
  976.                 var onlineArray = onlineURN.split(":");
  977.                 if(onlineArray.length > 3)
  978.                 {
  979.                   var online_tag = (onlineArray[6])?onlineArray[6]:'';
  980.                   publishOnline(onlineArray[1], onlineArray[3], selection.item, online_tag);
  981.                 }
  982.               }
  983.         },
  984.         checkForOnlineParent: function(aSelection)
  985.         {
  986.           var parentOnline = false;
  987.           
  988.           if(aSelection.length)
  989.           {
  990.             for (var i = 0; i < aSelection.length; i++) {
  991.               if (aSelection.parent[i] && !BookmarksUtils.foundLocalBookmarkParent(aSelection.parent[i].Value))
  992.               {
  993.                 parentOnline = true;
  994.                 break;
  995.               }
  996.             }
  997.           }else
  998.           {
  999.             dump('checkForOnlineParent '+  aSelection.Value +'\n');
  1000.             if(!BookmarksUtils.foundLocalBookmarkParent(aSelection.Value))
  1001.               parentOnline = true;
  1002.           }
  1003.           dump('checkForOnlineParent '+  parentOnline +'\n');
  1004.           return parentOnline;
  1005.         },
  1006.         
  1007.         onToggleOpenState: function (aRow)
  1008.         {
  1009.           // update the open attribute of the selection
  1010.           var selection = this.mOuter._selection;
  1011.           if (!selection)
  1012.             return;
  1013.           var resource = this.mOuter.getRowResource(aRow);
  1014.           for (var i=0; i<selection.length; ++i) {
  1015.             if (selection.item[i] == resource) {
  1016.               selection.isExpanded[i] = !selection.isExpanded[i];
  1017.               break;
  1018.             }
  1019.           }
  1020.         },
  1021.         
  1022.         onCycleHeader: function (aColumnID, aHeaderElement)
  1023.         {
  1024.           const kPrefSvcContractID = "@mozilla.org/preferences-service;1";
  1025.           const kPrefSvcIID = Components.interfaces.nsIPrefService;
  1026.           var prefSvc = Components.classes[kPrefSvcContractID].getService(kPrefSvcIID);
  1027.           var bookmarksSortPrefs = prefSvc.getBranch("browser.bookmarks.sort.");
  1028.           
  1029.           // Sorted! http://www.sorted.org.nz/
  1030.           this.mOuter.sorted = true;
  1031.  
  1032.           bookmarksSortPrefs.setCharPref("resource", aHeaderElement.getAttribute("sort"));
  1033.           bookmarksSortPrefs.setCharPref("direction", aHeaderElement.getAttribute("sortDirection"));
  1034.         },
  1035.     
  1036.         onSelectionChanged: function ()
  1037.         {
  1038.           
  1039.           var selection = this.mOuter.getTreeSelection();
  1040.           //treeSelection could return null! 
  1041.           if(selection && selection.item[0])
  1042.           {
  1043.             this.mOuter._selection = selection;
  1044.             this.mOuter._target    = this.mOuter.getTreeTarget(selection.item[0], selection.parent[0], BookmarksUtils.DROP_BEFORE);
  1045.           }
  1046.           this.mOuter.onCommandUpdate();
  1047.         },
  1048.         
  1049.         onCycleCell          : function (aItemIndex, aColumnID)          {},
  1050.         onPerformAction      : function (aAction)                        {},
  1051.         onPerformActionOnRow : function (aAction, aItemIndex)            {},
  1052.         onPerformActionOnCell: function (aAction, aItemIndex, aColumnID) {}
  1053.  
  1054.       })
  1055.       ]]></field>
  1056.  
  1057.       <!-- nsITransactionManager listener -->
  1058.       <field name="bookmarkTreeTransactionListener"><![CDATA[
  1059.       ({
  1060.  
  1061.         mOuter: this,
  1062.  
  1063.         mLastTxnWasDo: null,
  1064.  
  1065.         willDo: function (aTxmgr, aTxn) {},
  1066.         didDo : function (aTxmgr, aTxn) {
  1067.           this.mLastTxnWasDo = true;
  1068.           this.mOuter.preUpdateTreeSelection(aTxn, true);
  1069.         },
  1070.         willUndo: function (aTxmgr, aTxn) {},
  1071.         didUndo : function (aTxmgr, aTxn) {
  1072.           this.mLastTxnWasDo = false;
  1073.           this.mOuter.preUpdateTreeSelection(aTxn, false);
  1074.         },
  1075.         willRedo: function (aTxmgr, aTxn) {},
  1076.         didRedo : function (aTxmgr, aTxn) {
  1077.           this.mLastTxnWasDo = true;
  1078.           this.mOuter.preUpdateTreeSelection(aTxn, true);
  1079.         },
  1080.         didMerge       : function (aTxmgr, aTxn) {},
  1081.         didBeginBatch  : function (aTxmgr, aTxn) {},
  1082.         didEndBatch    : function (aTxmgr, aTxn) {
  1083.           this.mOuter.preUpdateTreeSelection(aTxn, this.mLastTxnWasDo);
  1084.         },
  1085.         willMerge      : function (aTxmgr, aTxn) {},
  1086.         willBeginBatch : function (aTxmgr, aTxn) {},
  1087.         willEndBatch   : function (aTxmgr, aTxn) {}
  1088.       })
  1089.       ]]></field>
  1090.     </implementation>
  1091.   </binding>
  1092.  
  1093.   <!-- Full Bookmarks Tree, multi-columned -->
  1094.   <!-- Localize column labels! -->
  1095.   <binding id="bookmarks-tree-full" extends="chrome://browser/content/bookmarks/bookmarksTree.xml#bookmarks-tree">
  1096.     <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xbl="http://www.mozilla.org/xbl"
  1097.                  contextmenu="_child">
  1098.       <!-- XXXben need focus event handler for cmd update -->
  1099.       <!-- context menu -->
  1100.       <menupopup onpopupshowing="this.parentNode.createTreeContextMenu(event);"
  1101.                  onpopuphidden="if (content) content.focus()"
  1102.                  onclick="event.stopPropagation();"
  1103.                  onkeypress="event.stopPropagation();"/>
  1104.       <vbox flex="1">
  1105.         <tree anonid="bookmarks-tree" flex="1" class="plain" enableColumnDrag="true"
  1106.                   datasources="rdf:flock-favorites rdf:files rdf:localsearch" ref="NS1:FoldersRoot" 
  1107.                   flags="dont-build-content" containment="folder"
  1108.                   onkeypress="if (event.keyCode == 13) this.parentNode.parentNode.openItemKey();"
  1109.                   onclick="this.parentNode.parentNode.openItemClick(event, 1);"
  1110.                   ondblclick="this.parentNode.parentNode.openItemClick(event, 2);"
  1111.                   ondraggesture="if (event.originalTarget.localName == 'treechildren') nsDragAndDrop.startDrag(event, this.parentNode.parentNode.DNDObserver);"
  1112.                   onselect="this.treeBoxObject.view.selectionChanged();">
  1113.           <template xmlns:nc="http://home.netscape.com/NC-rdf#"
  1114.                     xmlns:NS2="http://home.netscape.com/WEB-rdf#"
  1115.                     xmlns:NS1="http://flock.com/rdf#">
  1116.             <rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
  1117.               <treechildren>
  1118.                 <treeitem uri="rdf:*">
  1119.                   <treerow properties="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type separator">
  1120.                     <treecell properties="separator" label="rdf:http://home.netscape.com/NC-rdf#Name"/>
  1121.                   </treerow>
  1122.                 </treeitem>
  1123.               </treechildren>
  1124.             </rule>
  1125.             <rule rdf:type="http://home.netscape.com/NC-rdf#MicsumBookmark">
  1126.               <treechildren>
  1127.                 <treeitem uri="rdf:*">
  1128.                   <treerow properties="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type rdf:http://home.netscape.com/NC-rdf#loading rdf:http://home.netscape.com/WEB-rdf#status">
  1129.                     <treecell src="rdf:http://home.netscape.com/NC-rdf#Icon"
  1130.                               label="rdf:http://home.netscape.com/NC-rdf#GeneratedTitle"/>
  1131.                     <treecell label="rdf:http://home.netscape.com/NC-rdf#URL" />
  1132.                     <treecell label="rdf:http://home.netscape.com/NC-rdf#ShortcutURL" />
  1133.                     <treecell label="rdf:http://home.netscape.com/NC-rdf#Description" />
  1134.                     <treecell label="rdf:http://home.netscape.com/NC-rdf#BookmarkAddDate" />
  1135.                     <treecell label="rdf:http://home.netscape.com/WEB-rdf#LastModifiedDate" />
  1136.                     <treecell label="rdf:http://home.netscape.com/WEB-rdf#LastVisitDate"/>
  1137.                     <!--treecell label="rdf:http://flock.com/rdf#shared" /-->
  1138.                   </treerow>
  1139.                 </treeitem>
  1140.               </treechildren>
  1141.             </rule>
  1142.             <rule>
  1143.               <conditions anonid="folderFilterConditions">
  1144.                 <content uri="?parent"/>
  1145.                 <member container="?parent" child="?start"/>
  1146.                 <triple subject="?start"
  1147.                         predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
  1148.                         object="http://flock.com/rdf#Folder"/>
  1149.               </conditions>
  1150.               <bindings>
  1151.                 <binding subject="?start"
  1152.                          predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
  1153.                          object="?type"/>
  1154.                 <binding subject="?start"
  1155.                          predicate="http://home.netscape.com/NC-rdf#loading"
  1156.                          object="?loading"/>
  1157.                 <binding subject="?start"
  1158.                          predicate="http://home.netscape.com/WEB-rdf#status"
  1159.                          object="?status"/>
  1160.                 <binding subject="?start"
  1161.                          predicate="http://flock.com/rdf#favicon"
  1162.                          object="?favicon"/>
  1163.                 <binding subject="?start"
  1164.                          predicate="http://home.netscape.com/NC-rdf#Name"
  1165.                          object="?Name"/>
  1166.                 <binding subject="?start"
  1167.                          predicate="http://home.netscape.com/NC-rdf#URL"
  1168.                          object="?URL"/>
  1169.                 <binding subject="?start"
  1170.                          predicate="http://home.netscape.com/NC-rdf#ShortcutURL"
  1171.                          object="?ShortcutURL"/>
  1172.                 <binding subject="?start"
  1173.                          predicate="http://home.netscape.com/NC-rdf#Description"
  1174.                          object="?Description"/>
  1175.                 <binding subject="?start"
  1176.                          predicate="http://flock.com/rdf#tags"
  1177.                          object="?tags"/>
  1178.                 <binding subject="?start"
  1179.                          predicate="http://home.netscape.com/NC-rdf#BookmarkAddDate"
  1180.                          object="?BookmarkAddDate"/>
  1181.                 <binding subject="?start"
  1182.                          predicate="http://home.netscape.com/WEB-rdf#LastModifiedDate"
  1183.                          object="?LastModifiedDate"/>
  1184.                 <binding subject="?start"
  1185.                          predicate="http://home.netscape.com/WEB-rdf#LastVisitDate"
  1186.                          object="?LastVisitDate"/>
  1187.                 <!--binding subject="?start"
  1188.                          predicate="http://flock.com/rdf#shared"
  1189.                          object="?shared"/-->
  1190.               </bindings>
  1191.               <action>
  1192.                 <treechildren>
  1193.                   <treeitem uri="?start">
  1194.                     <treerow properties="?type ?loading ?status">
  1195.                       <treecell src="?favicon" label="?Name"/>
  1196.                       <treecell label="?URL"/>
  1197.                       <treecell label="?ShortcutURL"/>
  1198.                       <treecell label="?Description"/>
  1199.                       <treecell label="?tags"/>
  1200.                       <treecell label="?BookmarkAddDate"/>
  1201.                       <treecell label="?LastModifiedDate"/>
  1202.                       <treecell label="?LastVisitDate"/>
  1203.                       <!--treecell label="?shared"/-->
  1204.                     </treerow>
  1205.                   </treeitem>
  1206.                 </treechildren>
  1207.               </action>
  1208.             </rule>
  1209.             <rule rdf:type="http://flock.com/rdf#Favorite">
  1210.               <conditions anonid="filterConditions">
  1211.                 <content uri="?parent"/>
  1212.                 <member container="?parent" child="?start"/>
  1213.               </conditions>
  1214.               <bindings>
  1215.                 <binding subject="?start"
  1216.                          predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
  1217.                          object="?type"/>
  1218.                 <binding subject="?start"
  1219.                          predicate="http://home.netscape.com/NC-rdf#loading"
  1220.                          object="?loading"/>
  1221.                 <binding subject="?start"
  1222.                          predicate="http://home.netscape.com/WEB-rdf#status"
  1223.                          object="?status"/>
  1224.                 <binding subject="?start"
  1225.                          predicate="http://flock.com/rdf#favicon"
  1226.                          object="?favicon"/>
  1227.                 <binding subject="?start"
  1228.                          predicate="http://home.netscape.com/NC-rdf#Name"
  1229.                          object="?Name"/>
  1230.                 <binding subject="?start"
  1231.                          predicate="http://home.netscape.com/NC-rdf#URL"
  1232.                          object="?URL"/>
  1233.                 <binding subject="?start"
  1234.                          predicate="http://home.netscape.com/NC-rdf#ShortcutURL"
  1235.                          object="?ShortcutURL"/>
  1236.                 <binding subject="?start"
  1237.                          predicate="http://home.netscape.com/NC-rdf#Description"
  1238.                          object="?Description"/>
  1239.                 <binding subject="?start"
  1240.                          predicate="http://flock.com/rdf#tags"
  1241.                          object="?tags"/>
  1242.                 <binding subject="?start"
  1243.                          predicate="http://home.netscape.com/NC-rdf#BookmarkAddDate"
  1244.                          object="?BookmarkAddDate"/>
  1245.                 <binding subject="?start"
  1246.                          predicate="http://home.netscape.com/WEB-rdf#LastModifiedDate"
  1247.                          object="?LastModifiedDate"/>
  1248.                 <binding subject="?start"
  1249.                          predicate="http://home.netscape.com/WEB-rdf#LastVisitDate"
  1250.                          object="?LastVisitDate"/>
  1251.                 <!--binding subject="?start"
  1252.                          predicate="http://flock.com/rdf#shared"
  1253.                          object="?shared"/-->
  1254.               </bindings>
  1255.               <action>
  1256.                 <treechildren>
  1257.                   <treeitem uri="?start">
  1258.                     <treerow properties="?type ?loading ?status">
  1259.                       <treecell src="?favicon" label="?Name"/>
  1260.                       <treecell label="?URL"/>
  1261.                       <treecell label="?ShortcutURL"/>
  1262.                       <treecell label="?Description"/>
  1263.                       <treecell label="?tags"/>
  1264.                       <treecell label="?BookmarkAddDate"/>
  1265.                       <treecell label="?LastModifiedDate"/>
  1266.                       <treecell label="?LastVisitDate"/>
  1267.                       <!--treecell label="?shared"/-->
  1268.                     </treerow>
  1269.                   </treeitem>
  1270.                 </treechildren>
  1271.               </action>
  1272.             </rule>
  1273.           </template>
  1274.           <treecols anonid="treecols">
  1275.             <treecol id="Name" label="&treecol.name.label;" flex="1" primary="true" 
  1276.                           class="sortDirectionIndicator" 
  1277.                           persist="width hidden ordinal" 
  1278.                           sort="?Name"
  1279.                           sortActive="true" sortDirection="none"/>
  1280.             <splitter class="tree-splitter" />
  1281.             <treecol id="URL" label="&treecol.url.label;" 
  1282.                           flex="1" class="sortDirectionIndicator" 
  1283.                           sort="?URL"
  1284.                           persist="width hidden ordinal"/>
  1285.             <splitter class="tree-splitter" />
  1286.             <treecol id="ShortcutURL" label="&treecol.shortcut.label;" 
  1287.                           hidden="true" flex="1" class="sortDirectionIndicator" 
  1288.                           persist="hidden width ordinal" 
  1289.                           sort="?ShortcutURL"/>
  1290.             <splitter class="tree-splitter"/>
  1291.             <treecol id="Description" label="&treecol.description.label;" 
  1292.                           flex="1" class="sortDirectionIndicator" 
  1293.                           persist="hidden width ordinal" 
  1294.                           sort="?Description"/>
  1295.             <splitter class="tree-splitter"/>
  1296.             <treecol id="Tags" label="&treecol.tag.label;" 
  1297.                           flex="1" class="sortDirectionIndicator" 
  1298.                           sort="?tags"
  1299.                           persist="width hidden ordinal"/>
  1300.             <splitter class="tree-splitter"/>
  1301.             <treecol id="AddDate" label="&treecol.addedon.label;" 
  1302.                           hidden="true" flex="1" class="sortDirectionIndicator" 
  1303.                           sort="?BookmarkAddDate"
  1304.                           persist="width hidden ordinal"/>
  1305.             <splitter class="tree-splitter" />
  1306.             <treecol id="LastModDate" label="&treecol.lastmod.label;" 
  1307.                           hidden="true" flex="1" class="sortDirectionIndicator" 
  1308.                           sort="?LastModifiedDate"
  1309.                           persist="width hidden ordinal"/>
  1310.             <splitter class="tree-splitter"/>
  1311.             <treecol id="LastVisitDate" label="&treecol.lastvisit.label;" 
  1312.                           hidden="true" flex="1" class="sortDirectionIndicator" 
  1313.                           sort="?LastVisitDate"
  1314.                           persist="width hidden ordinal"/>
  1315.             
  1316.           </treecols>
  1317.         </tree>
  1318.       </vbox>
  1319.     </xbl:content>
  1320.     <implementation>
  1321.       <constructor>
  1322.         // Adding the transaction listener
  1323.         var bkmkTxnSvc = Components.classes["@mozilla.org/bookmarks/transactionmanager;1"]
  1324.                                    .getService(Components.interfaces.nsIBookmarkTransactionManager);
  1325.         bkmkTxnSvc.transactionManager.AddListener(this.bookmarkTreeTransactionListener);
  1326.       </constructor>  
  1327.       <destructor>
  1328.         var bkmkTxnSvc = Components.classes["@mozilla.org/bookmarks/transactionmanager;1"]
  1329.                                    .getService(Components.interfaces.nsIBookmarkTransactionManager);
  1330.         bkmkTxnSvc.transactionManager.RemoveListener(this.bookmarkTreeTransactionListener);
  1331.       </destructor>  
  1332.       <field name="clickCount">2</field>
  1333.     </implementation>
  1334.   </binding>
  1335.  
  1336.   <!-- Single column tree -->
  1337.   <binding id="bookmarks-tree-name" extends="chrome://browser/content/bookmarks/bookmarksTree.xml#bookmarks-tree">
  1338.     <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
  1339.                  xmlns:xbl="http://www.mozilla.org/xbl" contextmenu="_child">
  1340.       <!-- context menu -->
  1341.       <menupopup xbl:inherits="onpopupshowing"
  1342.                  onpopupshowing="this.parentNode.createTreeContextMenu(event);"
  1343.                  onpopuphidden="if (content) content.focus()"
  1344.                  onclick="event.stopPropagation();"
  1345.                  onkeypress="event.stopPropagation();"/>
  1346.       <tree anonid="bookmarks-tree" flex="1" class="plain" hidecolumnpicker="true"
  1347.                 datasources="rdf:flock-favorites rdf:files rdf:localsearch" ref="http://flock.com/rdf#BookmarksRoot" flags="dont-build-content" containment="folder"
  1348.                 onselect="this.parentNode.treeBoxObject.view.selectionChanged();" seltype="single">
  1349.         <template xmlns:nc="http://home.netscape.com/NC-rdf#"
  1350.                   xmlns:NS2="http://home.netscape.com/WEB-rdf#"
  1351.                   xmlns:NS1="http://flock.com/rdf#">
  1352.           <!--<rule rdf:type="http://flock.com/rdf#Folder"
  1353.                     rdf:id="http://flock.com/rdf#BookmarksRoot">
  1354.           </rule> -->
  1355.           <rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
  1356.             <treechildren>
  1357.               <treeitem uri="rdf:*">
  1358.                 <treerow properties="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type separator">
  1359.                   <treecell properties="separator" label="rdf:http://home.netscape.com/NC-rdf#Name"/>
  1360.                 </treerow>
  1361.               </treeitem>
  1362.             </treechildren>
  1363.           </rule>
  1364.           <rule rdf:type="http://home.netscape.com/NC-rdf#MicsumBookmark">
  1365.             <treechildren>
  1366.               <treeitem uri="rdf:*">
  1367.                 <treerow properties="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type rdf:http://home.netscape.com/NC-rdf#loading rdf:http://home.netscape.com/WEB-rdf#status">
  1368.                   <treecell src="rdf:http://home.netscape.com/NC-rdf#Icon"
  1369.                             label="rdf:http://home.netscape.com/NC-rdf#GeneratedTitle"/>
  1370.                 </treerow>
  1371.               </treeitem>
  1372.             </treechildren>
  1373.          </rule>
  1374.          <rule>
  1375.             <conditions anonid="folderFilterConditions">
  1376.               <content uri="?parent"/>
  1377.               <member container="?parent" child="?start"/>
  1378.               <triple subject="?start"
  1379.                       predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
  1380.                       object="http://flock.com/rdf#Folder"/>
  1381.             </conditions>
  1382.             <bindings>
  1383.               <binding subject="?start"
  1384.                        predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
  1385.                        object="?type"/>
  1386.               <binding subject="?start"
  1387.                        predicate="http://home.netscape.com/NC-rdf#loading"
  1388.                        object="?loading"/>
  1389.               <binding subject="?start"
  1390.                        predicate="http://home.netscape.com/WEB-rdf#status"
  1391.                        object="?status"/>
  1392.               <binding subject="?start"
  1393.                        predicate="http://flock.com/rdf#favicon"
  1394.                        object="?favicon"/>
  1395.               <binding subject="?start"
  1396.                        predicate="http://home.netscape.com/NC-rdf#Name"
  1397.                        object="?name"/>
  1398.             </bindings>
  1399.             <action>
  1400.               <treechildren>
  1401.                 <treeitem uri="?start">
  1402.                   <treerow properties="?type ?loading ?status">
  1403.                     <treecell src="?favicon"
  1404.                               label="?name"/>
  1405.                   </treerow>
  1406.                 </treeitem>
  1407.               </treechildren>
  1408.             </action>
  1409.            <treechildren> 
  1410.               <treeitem uri="rdf:*"> 
  1411.                 <treerow properties="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type rdf:http://home.netscape.com/NC-rdf#loading rdf:http://home.netscape.com/WEB-rdf#status"> 
  1412.                   <treecell src="rdf:http://flock.com/rdf#favicon" 
  1413.                             label="rdf:http://home.netscape.com/NC-rdf#Name"/> 
  1414.                 </treerow> 
  1415.             </treeitem> 
  1416.            </treechildren> 
  1417.          </rule>
  1418.          <rule>
  1419.             <conditions anonid="filterConditions">
  1420.               <content uri="?parent"/>
  1421.               <member container="?parent" child="?start"/>
  1422.             </conditions>
  1423.             <bindings>
  1424.               <binding subject="?start"
  1425.                        predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
  1426.                        object="?type"/>
  1427.               <binding subject="?start"
  1428.                        predicate="http://home.netscape.com/NC-rdf#loading"
  1429.                        object="?loading"/>
  1430.               <binding subject="?start"
  1431.                        predicate="http://home.netscape.com/WEB-rdf#status"
  1432.                        object="?status"/>
  1433.               <binding subject="?start"
  1434.                        predicate="http://flock.com/rdf#favicon"
  1435.                        object="?favicon"/>
  1436.               <binding subject="?start"
  1437.                        predicate="http://home.netscape.com/NC-rdf#Name"
  1438.                        object="?name"/>
  1439.             </bindings>
  1440.             <action>
  1441.               <treechildren>
  1442.                 <treeitem uri="?start">
  1443.                   <treerow properties="?type ?loading ?status">
  1444.                     <treecell src="?favicon"
  1445.                               label="?name"/>
  1446.                   </treerow>
  1447.                 </treeitem>
  1448.               </treechildren>
  1449.             </action>
  1450.           </rule>
  1451.         </template>
  1452.         <treecols anonid="treecols">
  1453.           <treecol id="Name" flex="1" primary="true" hideheader="true"
  1454.                    sort="rdf:http://home.netscape.com/NC-rdf#Name"
  1455.                    sortActive="true" sortDirection="none"/>
  1456.         </treecols>
  1457.       </tree>
  1458.     </xbl:content>
  1459.     <implementation>
  1460.       <field name="clickCount">1</field>
  1461.     </implementation>
  1462.   </binding>
  1463.  
  1464.   <!-- Tree with folders only -->
  1465.   <binding id="bookmarks-tree-folders" extends="chrome://browser/content/bookmarks/bookmarksTree.xml#bookmarks-tree">
  1466.     <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xbl="http://www.mozilla.org/xbl">
  1467.       <tree anonid="bookmarks-tree" class="bookmarksTree" flex="1" hidecolumnpicker="true"
  1468.             xbl:inherits="rows,seltype"
  1469.             datasources="rdf:flock-favorites rdf:files rdf:localsearch" ref="http://flock.com/rdf#FoldersRoot" flags="dont-build-content" containment="folder"
  1470.             onselect="this.parentNode.treeBoxObject.view.selectionChanged();">
  1471.         <template xmlns:nc="http://home.netscape.com/NC-rdf#"
  1472.                   xmlns:NS2="http://home.netscape.com/WEB-rdf#"
  1473.                   xmlns:NS1="http://flock.com/rdf#">
  1474.           <!-- I don't want these things to appear at all, but that's not an option -->
  1475.           <rule rdf:type="http://home.netscape.com/NC-rdf#Livemark">
  1476.             <treechildren>
  1477.               <treeitem uri="rdf:*">
  1478.                 <treerow properties="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type rdf:http://home.netscape.com/NC-rdf#loading rdf:http://home.netscape.com/WEB-rdf#status">
  1479.                   <treecell label="rdf:http://home.netscape.com/NC-rdf#Name" />
  1480.                 </treerow>
  1481.               </treeitem>
  1482.             </treechildren>
  1483.           </rule>
  1484.           <rule iscontainer="true">
  1485.             <treechildren>
  1486.               <treeitem uri="rdf:*">
  1487.                 <treerow properties="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type rdf:http://home.netscape.com/NC-rdf#loading rdf:http://home.netscape.com/WEB-rdf#status">
  1488.                   <treecell label="rdf:http://home.netscape.com/NC-rdf#Name" src="rdf:http://flock.com/rdf#favicon" />
  1489.                 </treerow>
  1490.               </treeitem>
  1491.             </treechildren>
  1492.           </rule>
  1493.         </template>
  1494.         <treecols anonid="treecols">
  1495.           <treecol id="Name" flex="1" primary="true" hideheader="true"
  1496.                    sort="rdf:http://home.netscape.com/NC-rdf#Name"
  1497.                    sortActive="true" sortDirection="none"/>
  1498.         </treecols>
  1499.       </tree>
  1500.     </xbl:content>
  1501.     <implementation>
  1502.       <field name="clickCount">2</field>
  1503.     </implementation>
  1504.   </binding>
  1505.   <!-- Tree with folders only -->
  1506.   <binding id="bookmarks-tree-folders-online" extends="chrome://browser/content/bookmarks/bookmarksTree.xml#bookmarks-tree">
  1507.     <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xbl="http://www.mozilla.org/xbl">
  1508.       <tree anonid="bookmarks-tree" class="bookmarksTree" flex="1" hidecolumnpicker="true"
  1509.             xbl:inherits="rows,seltype"
  1510.             datasources="rdf:flock-favorites rdf:files rdf:localsearch" ref="http://flock.com/rdf#OnlineBookmarksRoot" flags="dont-build-content" containment="folder"
  1511.             onselect="this.parentNode.treeBoxObject.view.selectionChanged();">
  1512.         <template xmlns:nc="http://home.netscape.com/NC-rdf#"
  1513.                   xmlns:NS2="http://home.netscape.com/WEB-rdf#"
  1514.                   xmlns:NS1="http://flock.com/rdf#">
  1515.           <!-- I don't want these things to appear at all, but that's not an option -->
  1516.           <rule rdf:type="http://home.netscape.com/NC-rdf#Livemark">
  1517.             <treechildren>
  1518.               <treeitem uri="rdf:*">
  1519.                 <treerow properties="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type rdf:http://home.netscape.com/NC-rdf#loading rdf:http://home.netscape.com/WEB-rdf#status">
  1520.                   <treecell label="rdf:http://home.netscape.com/NC-rdf#Name" />
  1521.                 </treerow>
  1522.               </treeitem>
  1523.             </treechildren>
  1524.           </rule>
  1525.            <rule iscontainer="true" rdf:type="http://flock.com/rdf#Folder">
  1526.               <treechildren>
  1527.                 <treeitem uri="rdf:*">
  1528.                   <treerow properties="tagRow rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type rdf:http://home.netscape.com/NC-rdf#loading rdf:http://home.netscape.com/WEB-rdf#status">
  1529.                     <treecell label="rdf:http://home.netscape.com/NC-rdf#Name" src="chrome://browser/skin/flock/favorites/tag.png"/>
  1530.                   </treerow>
  1531.                 </treeitem>
  1532.               </treechildren>
  1533.             </rule>
  1534.           <rule iscontainer="true" rdf:type="http://flock.com/rdf#OnlineFolder">
  1535.             <treechildren>
  1536.               <treeitem uri="rdf:*">
  1537.                 <treerow properties="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type rdf:http://home.netscape.com/NC-rdf#loading rdf:http://home.netscape.com/WEB-rdf#status">
  1538.                   <treecell label="rdf:http://home.netscape.com/NC-rdf#Name"  src="rdf:http://flock.com/rdf#favicon" />
  1539.                 </treerow>
  1540.               </treeitem>
  1541.             </treechildren>
  1542.           </rule>
  1543.         </template>
  1544.         <treecols anonid="treecols">
  1545.           <treecol id="Name" flex="1" primary="true" hideheader="true"
  1546.                    sort="rdf:http://home.netscape.com/NC-rdf#Name"
  1547.                    sortActive="true" sortDirection="none"/>
  1548.         </treecols>
  1549.       </tree>
  1550.     </xbl:content>
  1551.     <implementation>
  1552.       <field name="clickCount">2</field>
  1553.     </implementation>
  1554.   </binding>
  1555.   <binding id="bookmarks-tree-online" extends="chrome://browser/content/bookmarks/bookmarksTree.xml#bookmarks-tree">
  1556.     <xbl:content xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
  1557.                  xmlns:xbl="http://www.mozilla.org/xbl">
  1558.       <!-- context menu -->
  1559.       <menupopup xbl:inherits="onpopupshowing"
  1560.                  onpopupshowing="this.parentNode.createTreeContextMenu(event);"
  1561.                  onpopuphidden="if (content) content.focus()"
  1562.                  onclick="event.stopPropagation();"
  1563.                  onkeypress="event.stopPropagation();"/>
  1564.       <tree anonid="bookmarks-tree" flex="1" class="plain" hidecolumnpicker="true"
  1565.                 datasources="rdf:flock-favorites rdf:files rdf:localsearch" ref="http://flock.com/rdf#OnlineBookmarksRoot" flags="dont-build-content" containment="folder"
  1566.                 onselect="this.parentNode.treeBoxObject.view.selectionChanged();" seltype="single">
  1567.         <template xmlns:nc="http://home.netscape.com/NC-rdf#"
  1568.                   xmlns:NS2="http://home.netscape.com/WEB-rdf#"
  1569.                   xmlns:NS1="http://flock.com/rdf#">
  1570.           <!--<rule rdf:type="http://flock.com/rdf#Folder"
  1571.                     rdf:id="http://flock.com/rdf#BookmarksRoot">
  1572.           </rule> -->
  1573.           <rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
  1574.             <treechildren>
  1575.               <treeitem uri="rdf:*">
  1576.                 <treerow properties="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type separator">
  1577.                   <treecell properties="separator" label="rdf:http://home.netscape.com/NC-rdf#Name"/>
  1578.                 </treerow>
  1579.               </treeitem>
  1580.             </treechildren>
  1581.           </rule>
  1582.           <rule rdf:type="http://home.netscape.com/NC-rdf#MicsumBookmark">
  1583.             <treechildren>
  1584.               <treeitem uri="rdf:*">
  1585.                 <treerow properties="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type rdf:http://home.netscape.com/NC-rdf#loading rdf:http://home.netscape.com/WEB-rdf#status">
  1586.                   <treecell src="rdf:http://home.netscape.com/NC-rdf#Icon"
  1587.                             label="rdf:http://home.netscape.com/NC-rdf#GeneratedTitle"/>
  1588.                 </treerow>
  1589.               </treeitem>
  1590.             </treechildren>
  1591.           </rule>
  1592.           <rule>
  1593.             <conditions anonid="folderFilterConditions">
  1594.               <content uri="?parent"/>
  1595.               <member container="?parent" child="?start"/>
  1596.               <triple subject="?start"
  1597.                       predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
  1598.                       object="http://flock.com/rdf#Folder"/>
  1599.             </conditions>
  1600.             <bindings>
  1601.               <binding subject="?start"
  1602.                        predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
  1603.                        object="?type"/>
  1604.               <binding subject="?start"
  1605.                        predicate="http://home.netscape.com/NC-rdf#loading"
  1606.                        object="?loading"/>
  1607.               <binding subject="?start"
  1608.                        predicate="http://home.netscape.com/WEB-rdf#status"
  1609.                        object="?status"/>
  1610.               <binding subject="?start"
  1611.                        predicate="http://flock.com/rdf#favicon"
  1612.                        object="?favicon"/>
  1613.               <binding subject="?start"
  1614.                        predicate="http://home.netscape.com/NC-rdf#Name"
  1615.                        object="?name"/>
  1616.             </bindings>
  1617.             <action>
  1618.               <treechildren>
  1619.                 <treeitem uri="?start">
  1620.                   <treerow properties="tagRow ?type ?loading ?status">
  1621.                     <treecell src="chrome://browser/skin/flock/favorites/tag.png"
  1622.                               label="?name"/>
  1623.                   </treerow>
  1624.                 </treeitem>
  1625.               </treechildren>
  1626.             </action>
  1627.           </rule>
  1628.           <rule iscontainer="true" rdf:type="http://flock.com/rdf#OnlineFolder">
  1629.             <treechildren>
  1630.               <treeitem uri="rdf:*">
  1631.                 <treerow properties="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type rdf:http://home.netscape.com/NC-rdf#loading rdf:http://home.netscape.com/WEB-rdf#status">
  1632.                   <treecell label="rdf:http://home.netscape.com/NC-rdf#Name" src="rdf:http://flock.com/rdf#favicon"/>
  1633.                 </treerow>
  1634.               </treeitem>
  1635.             </treechildren>
  1636.           </rule>
  1637.          <rule>
  1638.             <conditions anonid="filterConditions">
  1639.               <content uri="?parent"/>
  1640.               <member container="?parent" child="?start"/>
  1641.             </conditions>
  1642.             <bindings>
  1643.               <binding subject="?start"
  1644.                        predicate="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
  1645.                        object="?type"/>
  1646.               <binding subject="?start"
  1647.                        predicate="http://home.netscape.com/NC-rdf#loading"
  1648.                        object="?loading"/>
  1649.               <binding subject="?start"
  1650.                        predicate="http://home.netscape.com/WEB-rdf#status"
  1651.                        object="?status"/>
  1652.               <binding subject="?start"
  1653.                        predicate="http://flock.com/rdf#favicon"
  1654.                        object="?favicon"/>
  1655.               <binding subject="?start"
  1656.                        predicate="http://home.netscape.com/NC-rdf#Name"
  1657.                        object="?name"/>
  1658.             </bindings>
  1659.             <action>
  1660.               <treechildren>
  1661.                 <treeitem uri="?start">
  1662.                   <treerow properties="?type ?loading ?status">
  1663.                     <treecell src="?favicon"
  1664.                               label="?name"/>
  1665.                   </treerow>
  1666.                 </treeitem>
  1667.               </treechildren>
  1668.             </action>
  1669.           </rule>
  1670.         </template>
  1671.         <treecols anonid="treecols">
  1672.           <treecol id="Name" flex="1" primary="true" hideheader="true"
  1673.                    sort="rdf:http://home.netscape.com/NC-rdf#Name"
  1674.                    sortActive="true" sortDirection="none"/>
  1675.         </treecols>
  1676.       </tree>
  1677.     </xbl:content>
  1678.     <implementation>
  1679.       <field name="clickCount">1</field>
  1680.     </implementation>
  1681.   </binding>
  1682.   
  1683. </bindings>
  1684.